package com.luoyx.hauyne.admin.amqp.producer;

import com.luoyx.hauyne.admin.api.sys.request.UserProfileUpdatedMsg;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import static com.luoyx.hauyne.admin.config.QueueConfig.USER_PROFILE_UPDATED_EXCHANGE_NAME;
import static com.luoyx.hauyne.admin.config.QueueConfig.USER_PROFILE_UPDATED_ROUTING_NAME;


@Slf4j
@Component
@RequiredArgsConstructor
public class UserProfileUpdatedProducer {

    private final RabbitTemplate rabbitTemplate;

    public void send(UserProfileUpdatedMsg userProfileUpdatedMsg){
        log.debug("生产消息【{}】", userProfileUpdatedMsg);
        this.rabbitTemplate.convertAndSend(USER_PROFILE_UPDATED_EXCHANGE_NAME,
                USER_PROFILE_UPDATED_ROUTING_NAME, userProfileUpdatedMsg);
    }
}
